﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PPIDesktopClient.Entities;
using System.Data;
using PPIProxy;
using VMind.Global;
using PPIDesktopClient.General;

namespace PPIDesktopClient.Logic
{
    public class LCentralOffice
    {
        public static List<ECentralOffice> SelectAll()
        {
            ConfigReader _ConfigReader = ConfigReader.GetInstance();
            DataTable _dt = PPIProxy.WCentralOffice.SelectAll(_ConfigReader.GetConnectionString()).Tables[0];
            List<ECentralOffice> _officeList = new List<ECentralOffice>();
            ECentralOffice _office;
            foreach (DataRow dr in _dt.Rows)
            {
                _office = new ECentralOffice(ConvertHelper.ToInt32(dr["CentralOfficeId"]), ConvertHelper.Tostring(dr["Name"]), ConvertHelper.Todouble(dr["Latitude"]), ConvertHelper.Todouble(dr["Longitude"]), ConvertHelper.Tostring(dr["Address"]));
                _officeList.Add(_office);
            }
            return _officeList;


        }

    }
}
